Skip to content

fix: repair failing tests and type errors across api and shared packages - #103

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier2-2420-1785001417
Open

fix: repair failing tests and type errors across api and shared packages#103
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier2-2420-1785001417

Conversation

@stooit

@stooit stooit commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all failing tests and eliminates all tsc --noEmit type errors. bun test now reports 22 pass / 0 fail and typecheck is clean.

Changes

  • packages/shared/src/utils/pagination.ts — implemented the paginate() stub (was throwing not implemented): correct page slicing, total/totalPages, page/pageSize, and empty data for out-of-range pages.
  • tsconfig.json — added "types": ["bun-types"] (package already installed) so process and bun:test globals resolve across both packages.
  • packages/api/src/routes/users.ts — imported the missing badRequest helper that caused a failure in the users route.
  • packages/shared/src/types.ts — renamed User.userNameusername to match the contract the tests expect, and updated all cross-package usages.
  • packages/api/src/middleware/auth.ts — fixed a case-sensitivity bug in the public-route check so POST /users is correctly treated as public.

Assumptions

  • Tests define the contract: where source and tests disagreed on the field name, source was changed to username (tests unmodified).
  • No test files modified, no dependencies added. bun-types was already in node_modules.

Verification

  • bun test → 22 pass, 0 fail
  • bunx tsc --noEmit → clean

- implement paginate() stub in shared with correct slicing and totals
- wire bun-types into tsconfig for process/bun:test globals
- import missing badRequest helper in users route
- rename User.userName -> username for cross-package consistency
- fix case-sensitivity bug in auth middleware public-route method check
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant